package robotname

import (
	"math/rand"
	"time"
)

const testVersion = 1

var R = rand.New(rand.NewSource(time.Now().UnixNano()))

type Robot struct {
	name string
}

func (r *Robot) Name() string {
	if r.name != "" {
		return r.name
	}

	names := make([]rune, 5)
	names[0] = rune(R.Intn(26) + 65)
	names[1] = rune(R.Intn(26) + 65)
	names[2] = rune(R.Intn(10) + 48)
	names[3] = rune(R.Intn(10) + 48)
	names[4] = rune(R.Intn(10) + 48)

	r.name = string(names)
	return r.name
}

func (r *Robot) Reset() {
	r.name = ""
}
